home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
45975
/
45975.xpi
/
components
/
Startup.js
Wrap
Text File
|
2009-11-19
|
3KB
|
65 lines
/*
* Copyright (c) 2009 Bui Viet Thanh (thanhbv@gmail.com).
*
* This file is part of clicknlearn.
*
* clicknlearn is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* clicknlearn is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with clicknlearn. If not, see <http://www.gnu.org/licenses/>.
*/
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
/**
* see: https://developer.mozilla.org/en/Observer_Notifications
*/
function WeaveSyncStartup() {}
WeaveSyncStartup.prototype =
{
classDescription: "Weave Sync Startup",
contractID: "@clicknlearn.googlecode.com/weavesync/startup;1",
classID: Components.ID("{7799cb20-4de9-11de-8a39-0800200c9a67}"),
_xpcom_categories: [{ category: "app-startup", service: true }],
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
observe: function(subject, topic, data){
switch (topic){
case "app-startup":
let observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
observerService.addObserver(this, "final-ui-startup", true);
break;
case "final-ui-startup":
//see https://developer.mozilla.org/en/Toolkit_API/extIApplication
let Application = Components.classes["@mozilla.org/fuel/application;1"]
.getService(Components.interfaces.fuelIApplication);
let weaveExt = Application.extensions.get("{340c2bbc-ce74-4362-90b5-7c26312808ef}");
// let alertsService = Components.classes["@mozilla.org/alerts-service;1"]
// .getService(Components.interfaces.nsIAlertsService);
// alertsService.showAlertNotification("chrome://mozapps/skin/downloads/downloadIcon.png",
// "Alert title", weaveExt == null? "weaveExt == null" : weaveExt.enabled,
// false, "", null);
if(weaveExt == null || ! weaveExt.enabled)
return;
let subscriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
subscriptLoader.loadSubScript("chrome://clicknlearn/content/weaveIntegration.js");
break;
}
}
};
var NSGetModule = XPCOMUtils.generateNSGetModule([WeaveSyncStartup]);